﻿<UserControl x:Class="Common.Controls.ImageViewer"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="clr-namespace:Common.Controls"  Loaded="ImageViewer_Loaded" Unloaded="UserControl_Unloaded">
    <Grid Name="MainPanel"  MaxHeight="600">
        <Border Name="BackGroundBorder">
            <ProgressBar Name="progressBar" Height="10" Width="90" ></ProgressBar>
        </Border>
        <ScrollViewer Name="ImageScrollViewer" VerticalScrollBarVisibility="Auto">
            <Border Name="MasterImageBorder" Margin="4" 
              Background="White" BorderBrush="#22000000"
                Width="{Binding ElementName=image, Path=ActualWidth}" Height="{Binding ElementName=image, Path=ActualHeight}">
                <local:ImageExpender x:Name="image"
                   MouseLeftButtonDown="MasterImage_MouseLeftButtonDown" MouseLeftButtonUp="MasterImage_MouseLeftButtonUp" MouseMove="MasterImage_MouseMove" MouseWheel="MasterImage_MouseWheel" Stretch="None">
                    <Image.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform x:Name="scaleTransform"></ScaleTransform>
                            <TranslateTransform x:Name="translateTransform"></TranslateTransform>
                            <RotateTransform x:Name="rotateTransform"></RotateTransform>
                        </TransformGroup>
                    </Image.RenderTransform>
                </local:ImageExpender>
            </Border>
        </ScrollViewer>
    </Grid>
</UserControl>
